<template>
  <section v-loading="loading" class="cms-body">
    <div class="cms-list-header flex-between">
      <el-button type="primary" icon="el-icon-plus" @click="routerLink('/liveUser/save','save',0)"
                 v-perms="'/liveUser/save'">添加
      </el-button>
      <!-- 右操作 -->
      <div>
        <el-select v-model="params.statu" @change="goQuery()">
          <el-option label="状态" value=""></el-option>
          <el-option label="启用" value="0"></el-option>
          <el-option label="禁用" value="1"></el-option>
        </el-select>
        <cms-input label="登录账号" v-model="params.userName"></cms-input>
        <el-button @click="goQuery">查询</el-button>
      </div>
    </div>
    <!-- 表格 -->
    <el-table :data="tableData" stripe style="width: 100%" @selection-change="checkIds">
      <el-table-column type="selection" width="35" align="right"></el-table-column>
      <el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>
      <el-table-column prop="userName" label="登录账号" width="180" align="center"></el-table-column>
      <el-table-column prop="realName" label="姓名" align="center"></el-table-column>
      <el-table-column prop="userImg" label="头像" align="center">
        <template slot-scope="scope">
          <img-preivew :src="scope.row.userImg | imgPathFilter"></img-preivew>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="创建时间" align="center" width="120"></el-table-column>
      <el-table-column prop="" label="状态" align="center" width="75">
        <div slot-scope="scope">
          <span v-if="scope.row.statu==false">启用</span>
          <span v-else class="red">禁用</span>
        </div>
      </el-table-column>
      <el-table-column prop="name" label="操作" align="center" width="95">
        <div slot-scope="scope">
          <a href="javascript:void(0)"
             class="cms-table-button el-icon-lock"
             title="重置密码" @click="routerLink('/liveUser/editPw','update',scope.row.id)" v-perms="'/liveUser/editPw'">
          </a>
          <cms-button type="edit" @click.native="routerLink('/liveUser/update','update',scope.row.id)"
                      v-perms="'/liveUser/update'"></cms-button>
          <cms-button type="delete" @click.native="deleteBatch($api.userDelete,scope.row.id)"
                      v-perms="'/liveUser/delete'"></cms-button>
        </div>
      </el-table-column>
    </el-table>
    <!-- 表格底部 -->
    <div class="cms-list-footer">
      <div class="cms-left">
        <el-button :disabled="disabled" @click="deleteBatch($api.userDelete,ids)" v-perms="'/liveUser/delete'">批量删除
        </el-button>
      </div>
      <!-- cms分页组件 -->
      <cms-pagination :total="total" @change="getPages"></cms-pagination>
    </div>
  </section>
</template>

<script>
  import listMixins from '@/mixins/list'

  export default {
    mixins: [listMixins],
    data() {
      return {
        params: {//只需要业务参数
          queryUsername: "",
          queryEmail: "",
          queryGroupId: "",
          queryStatus: "",
          pageNo: 1,
          pageSize: 10,
          departId: 3
        }
      };
    },
    methods: {
      goQuery() {
        this.getTableData(this.params);
      }
    },
    created() {
      this.initTableData(this.$api.userPageList, this.params);
    }
  };
</script>

<style>

</style>
